import socket

sock=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
sock.connect(("127.0.0.1",7799))
lines = 'GET / HTTP/1.1\r\n'
lines += 'Host: www.baidu.com:80\r\n'
lines += 'User-Agent: python-requests/2.24.0\r\n'
lines += 'Accept-Encoding: gzip, deflate\r\n'
lines += 'Accept: */*\r\n'
lines += 'Connection: keep-alive\r\n'
lines += '\r\n\r\n'
body="你好，我是往往"
data=lines+body

sock.send(data.encode())
content=sock.recv(1024)
print("服务器的响应结果是：",content)
